using System;
using System.Collections.Generic;
using System.Text;
using Web.Core.Providers;
using System.Collections;

namespace Web.Core.Objects
{
    public class Orders
    {
        public static int InsertOrder(Order o)
        {
            return DataProvider.GetInstance().InsertDeleteUpdateOrder(o, GlobalStorage.Action.Insert);
        }

        public static int UpdateOrder(Order o)
        {
            return DataProvider.GetInstance().InsertDeleteUpdateOrder(o, GlobalStorage.Action.Update);
        }

        public static int DeleteOrder(Order o)
        {
            return DataProvider.GetInstance().InsertDeleteUpdateOrder(o, GlobalStorage.Action.Delete);
        }

        public static ArrayList GetOrderByPage(int pageNum, int pageSize, int memID)
        {
            return DataProvider.GetInstance().GetOrders(new Order(0, 0, GlobalStorage.State.Any, ""), pageNum, pageSize, memID);
        }

        public static Order GetOrderByID(int id)
        {
            return DataProvider.GetInstance().GetOrders(new Order(id, 0, GlobalStorage.State.Any, ""), 1, 0, 0)[0] as Order;
        }

        public static int CountAllOrderByMemberID(int memID)
        {
            return DataProvider.GetInstance().CountOrdersByMemberID(memID);
        }

        public static int CountAllOrders()
        {
            return DataProvider.GetInstance().CountOrders(new Order(0, 0, GlobalStorage.State.Any, ""));
        }

        public static ArrayList GetAllOrders()
        {
            return DataProvider.GetInstance().GetOrders(new Order(0, 0, GlobalStorage.State.Any, ""), 1, 0, 0);
        }
    }
}
